import book.BookList;
import user.MasterUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login() {
        System.out.println("请输入你的名字：");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        System.out.println(name + "欢迎来到图书管理系统");
        System.out.println("你是管理员还是读者？");
        System.out.println("1.管理员");
        System.out.println("2.读者");
        int choice = sc.nextInt();
        if (choice == 1) {
            return new MasterUser(name);
        } else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        while (true) {
            User user = login();
            int choice = user.menu();
            user.dooperation(choice, bookList);
        }
    }
}
